#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int L = 2e6+10;
const int N = 1e4+10;

vec pot[L];
int mx,ans,now,del[L],hig[L],n,x[N],d[N];

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1,y;i <= n;i++) x[i] = in,y = in,d[i] = in,pot[y].pb(i),mx = max(mx,y + d[i]);
	for(int i = 0;i <= mx;i++){
		ans += 2 * now - del[i]; now -= del[i];
		for(auto l : pot[i]){
			for(int k = 0;k < d[l];k++)
				if(i + d[l] - k > hig[x[l] + k]){
					if(hig[x[l] + k] <= i) now++;
					del[hig[x[l] + k]]--; hig[x[l] + k] = i + d[l] - k; del[hig[x[l] + k]]++;
				}
		}
	}
	printf("%.1lf\n",ans / 2.0);
	return 0;
}
